home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / d86bios4.zip / BIOS.8 next >
Text File  |  1989-04-30  |  22KB  |  462 lines

  1. ;---------------
  2. ;   BIOS module for the D86 debugger
  3. ;---------------
  4.  
  5. ; Copyright 1987,88 Eric Isaacson.  All rights reserved.  Permission to
  6. ; copy and use this module is granted ONLY for machines registered for both
  7. ; the A86 assembler and the D86 debugger.
  8.  
  9. ; Current support: IBM-PC, Wang PC, TI-PC, Sanyo 555, Tandy 2000,
  10. ;     and Sirius/Victor 9000, DEC RAINBOW, and Zenith Z-100.
  11.  
  12. ; This module defines the BIOS interface for my D86 debugger.  I am publishing
  13. ; it to assist those who wish to assist me in implementing D86 on machines not
  14. ; BIOS-compatible with the IBM-PC.  To support a non-standard BIOS, we must
  15. ; provide new keyboard codes, new action routines, and several other data
  16. ; quantities.  This module provides a routine BIOS_INIT that sets everything
  17. ; up according to the machine being used.  BIOS_INIT must do four things:
  18. ;
  19. ; 1. The routine must figure out what machine we are running on.  The best
  20. ;    way to do this is to find a machine-specific identifier in a fixed
  21. ;    area of memory (ROM or the BIOS).  If you can locate such an identifier,
  22. ;    you can simply create an entry in the BIOS_SIGS structure below.
  23. ;
  24. ; 2. The routine must point SI to a special data structure (which I'll
  25. ;    describe shortly), then call the routine NEW_KEYS, to propagate the
  26. ;    items in the structure to the necessary places throughout the debugger.
  27. ;
  28. ; 3. The routine must perform any initializations necessary for this BIOS.
  29. ;    For example, WANG_CONFIG locates and stores the port number for hardware
  30. ;    that enables video access on the Wang.
  31. ;
  32. ; 4. The routine must decide if the debugger is running on the same screen as
  33. ;    the user program.  If it is, it must move the user's cursor to the lower
  34. ;    left corner of the screen.
  35. ;
  36. ; The structure fed to NEW_KEYS contains all the data necessary for ongoing
  37. ; debugger execution under the new BIOS.  See the structure WANG_KEYS for a
  38. ; prototype.  The structure consists of the following:
  39. ;
  40. ;  * a byte giving the keyboard code for the debugger's HELP key.
  41. ;
  42. ;  * a byte declaring the difference between your BIOS's key codes for
  43. ;    function keys, and the IBM BIOS's key codes.  Your BIOS_KEY must return
  44. ;    consecutive values for the function keys F1 through F10.  You should
  45. ;    declare this byte to be X - FUNC, where X is one less than the code
  46. ;    returned by the F1 key.  For example, since the Wang F1 key returns hex
  47. ;    080, the byte is declared 07F - FUNC.
  48.  
  49. ;  * a number of bytes giving code values for all the other control keys
  50. ;    used by the debugger.  This list will be expanding with new versions;
  51. ;    see WANG_KEYS for the current version's list.  You should precede the list
  52. ;    with the L1 label, and follow it with the declaration N_CONTROL_KEYS EQU
  53. ;    $-L1, exactly as shown.  Don't change the name N_CONTROL_KEYS; the
  54. ;    redeclaration of the same name insures that you've gotten the right number
  55. ;    of codes into the table.
  56. ;
  57. ;  * a word pointing to a message string with the name of the help-key.  If your
  58. ;    keyboard has a key labelled HELP, use the name HELP_HELP as in WANG_KEYS.
  59. ;    If there is another key nonexistent on the IBM-PC (e.g. F11), then put
  60. ;    a new name (e.g. F11_HELP) following DW; I'll supply the definition for
  61. ;    the new name.  If there is no extra key and no HELP key, use Alt-F10 as
  62. ;    on the IBM-PC, and declare DW ALTF10_HELP here.
  63. ;
  64. ;  * the label L2: to be used to verify the number of following bytes.
  65. ;
  66. ;  * pointers to your BIOS's versions of the procedures VID_COPY, VID_ATTR,
  67. ;    VID_FIX, BIOS_BELL, and BIOS_KEY, described shortly. Substitute the name
  68. ;    of your machine for VID and BIOS in the generic names; e.g. the WANG_KEYS
  69. ;    structure has WANG_COPY, WANG_ATTR, WANG_BELL, and WANG_KEY.
  70. ;
  71. ;  * a word giving the segment register value for video memory on your machine.
  72. ;    The debugger will supply this value in the ES register when it calls
  73. ;    VID_COPY and VID_ATTR.  That is all the debugger does with it; so this
  74. ;    value can really be anything that the BIOS's versions of VID_COPY and
  75. ;    VID_ATTR want.
  76. ;
  77. ;  * a byte giving the attribute value for normal video.  This attribute will
  78. ;    be in effect for the entire debugger screen, except for the location of
  79. ;    the debugger's cursor.
  80. ;
  81. ;  * a byte giving the attribute value for reverse video.  This attribute will
  82. ;    be used to mark the debugger cursor.
  83. ;
  84. ;  * the declaration N_BIOS_CALLS EQU ($-L2)/2  Again, don't change the name;
  85. ;    the redeclaration of the name insures you didn't leave anything out.
  86. ;
  87. ; This completes the description of the structure fed to NEW_KEYS.  After
  88. ; BIOS_INIT is called, the debugger will keep calling 7 action routines to
  89. ; perform its interactive I/O.    The routines must perform actions as
  90. ; follows:
  91.  
  92. ; VID_COPY copies CL bytes of characters from DS:SI to the video memory whose
  93. ;   location is given by ES:DI.  The characters should have the attribute
  94. ;   NORM_ATTR, which the caller will place into AH for VID_COPY's convenience.
  95. ;   VID_COPY must place the character byte and the attribute byte into each
  96. ;   output video word.    VID_COPY must return with BL preserved, the high byte
  97. ;   of SI preserved (it will be if you leave SI pointing beyond the bytes
  98. ;   copied), and DI advanced beyond the video memory just output.  The caller
  99. ;   assumes that video memory can be found at the value of VIDEO_SEG set by
  100. ;   BIOS_INIT, starting at offset 0, and proceeding consecutively, one 16-bit
  101. ;   memory word for every character.  The caller will set CH=0 for its first
  102. ;   call, so that VID_COPY can use CX as the count; but if it does, it must
  103. ;   return CH=0 for subsequent calls.
  104.  
  105. ; VID_ATTR places the attribute byte AL into the video word whose location is
  106. ;   given by ES:DI.  The character byte of the video word must not be disturbed.
  107.  
  108. ; VID_FIX restores a video screen that might have been clobbered by programs
  109. ;   external to the debugger.  If VID_COPY copies all characters to video memory
  110. ;   every time, then VID_FIX should RET without doing anything.  If, however,
  111. ;   VID_COPY tries to keep track of which characters are already on the screen,
  112. ;   and suppress video output for those that are, then VID_FIX should disable
  113. ;   the suppression feature, call the debugger's routine REFRESH to update the
  114. ;   whole screen, then re-enable the suppression feature.
  115.  
  116. ; BIOS_BELL rings the bell.  NOTE that it is not acceptible for BIOS_BELL to
  117. ;   use the MS-DOS write routine to send a bell control-code to standard output;
  118. ;   if it did, then the debugger couldn't debug programs that have redirected
  119. ;   their standard output-- the bell code would go to the user program's output
  120. ;   file, and not be translated into a beep.
  121.  
  122. ; BIOS_KEY returns in AL a code for a single keystroke.  The code should be
  123. ;   compatible with the values placed into the debugger's function tables by
  124. ;   BIOS_INIT.    If there is no keystroke available, BIOS_KEY should wait until
  125. ;   there is one.  BIOS_KEY should return on each individual key, and not wait
  126. ;   for any line-editing to take place.
  127.  
  128. ; BIOS_SAVE saves whatever there is about the user program's BIOS state that
  129. ;   might be clobbered by the debugger.  Currently, the only such thing is
  130. ;   the user's cursor position on the Sanyo.  So on all machines but the Sanyo,
  131. ;   this is a "do-nothing" routine.
  132.  
  133. ; BIOS_RESTORE restores the BIOS state saved by BIOS_SAVE.  Again, this routine
  134. ;   does nothing except on the Sanyo, on which it restores the user cursor
  135. ;   position, clobbered because D86 must use BIOS calls to write to the Sanyo
  136. ;   screen.
  137.  
  138.  
  139. BIOS_SIGNATURE  MACRO
  140.   DB #1       ; case number for the machine being sought
  141.   DB #NL-2    ; number of far pointers to look at
  142.   DB >M2      ; length byte for the following string
  143. M1:
  144.   DB #2       ; BIOS signature string we are looking for
  145. M2 EQU $-M1   ; we calculate the forward-reference length byte here
  146. #RX3L         ; loop for remaining macro operands
  147.   DD #X       ; far pointers to each place where the string might be found
  148. #ER
  149. #EM
  150.  
  151. BIOS_SIGS:
  152.